﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
//using System.Windows.Forms;

namespace UCWebpart.Admin
{
    public partial class MeetingroomManage : System.Web.UI.Page
    {

        string uName;
        string uType1;
        string uType3;
        string uLevel;

        protected void Page_Load(object sender, EventArgs e)
        {
            uName = Session["userName"].ToString();
            uType1 = Session["orgType1"].ToString();
            uType3 = Session["orgType3"].ToString();
            uLevel = Session["adminLevel"].ToString();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string Name = mtrName.Text.ToString();
            string CompanyRuc = mtrCompanyRuc.SelectedItem.Text.ToString();
            string DeptRuc = mtrDeptRuc.Text.ToString();
            string Address = mtrAddress.Text.ToString();
            string Address1 = mtrAddress1.Text.ToString();
            int cap = Convert.ToInt32(mtrCap.Text);
            string pho = mtrPhone.Text.ToString();
            string type = mtrType.Text.ToString();
            int LongestBookingDay= Convert.ToInt32(mtrLongestBookingDay.Text);
            using (var mtr_Add = new meetingroomManagementEntities())
            {
                MTR_bas_Meetingroom mtr = new MTR_bas_Meetingroom();
                mtr.mtrName = Name;
                mtr.mtrCompanyRuc = CompanyRuc;
                mtr.mtrDeptRuc = DeptRuc;
                mtr.mtrAddress = Address;
                mtr.mtrAddress1 = Address1;
                mtr.mtrCapacity = cap;
                mtr.mtrPhone = pho;
                mtr.mtrType = type;
                mtr.mtrLongestBookingDay = LongestBookingDay;
                mtr.mtrDelete = true;
                mtr.mtrState = true;

                mtr_Add.MTR_bas_Meetingroom.Add(mtr);
                mtr_Add.SaveChanges();
            }
        }

        protected void TextBox1_TextChanged(object sender, EventArgs e)
        {
           
        }
    
        protected void mtrCompanyRuc_SelectedIndexChanged(object sender, EventArgs e)
        {
            int companyId = Convert.ToInt32(mtrCompanyRuc.SelectedValue);
            string companyABBR = mtrCompanyRuc.SelectedValue;
        }

        protected void mtrCompanyRuc_SelectedIndexChanged1(object sender, EventArgs e)
        {
            int companyId = Convert.ToInt32(mtrCompanyRuc.SelectedValue);
            string companyABBR = mtrCompanyRuc.SelectedItem.Text;
        }

        protected void mtrCompanyRuc_TextChanged(object sender, EventArgs e)
        {
            int companyId = Convert.ToInt32(mtrCompanyRuc.SelectedValue);
            string companyABBR = mtrCompanyRuc.SelectedValue;
        }

        protected void mtrAddress_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}